\documentclass[a4paper]{ctexart}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{enumerate}
\CTEXsetup[format = {\Large\bfseries}]{section}
\setlength{\parindent}{0pt}
\title{第三次作业(1-4)}
\author{付临\\3200104960\\信息与计算科学}
\renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
\renewcommand\thesubsection{\roman{subsection}} % roman numerals for subsections

\begin{document}
\maketitle
\section{}
Solution:\\
Since s $\in \mathbb{S}_{3}^{2}$, s $\in C^2[0,2]$. Let $p(x) = ax^3+bx^2+cx+d$, then 
we have $p'(x) = 3ax^2+2bx+c$, $p''(x) = 6ax+2b$. Since s $\in C^2[0,2]$ and s(0)=0,
we have
\begin{equation*} 
\left\{\begin{aligned}
    &3a+2b+c=-3(2-1)^{2}\\
    &6a+2b=6(2-1)\\
    &d=0\\
    &a+b+c+d=1\\
\end{aligned}\right.
\end{equation*}
So a=7, b=-18, c=12, d=0, $p(x)=7x^3-18x^2+12x$. Because $p''(0) \neq 0$, so s(x) is not 
a natural cubic spline.

\section{}
Solution:\\
$\bullet$Since s $\in \mathbb{S}_{2}^{1}$, s is a polynomial of degree less 
than 3 in each cell. So it has three coefficients. Becouse there are n-1 cells,
so there are 3(n-1) coefficients. However, the interpolation condition, and the 
spline condition give a total of 3n-4 conditions, so we need an additional condition 
to determine s uniquely.

$\bullet$
\begin{equation*}
    \begin{array}{c|ccc}
    x_i & f_i & &  \\
    x_i & f_i & m_i &  \\
    x_{i+1} & f_{i+1} & K_i & \frac{K_i-m_i}{x_{i+1}-x_i} \\
    \end{array}
\end{equation*}
Then the Newton formual yields
\begin{equation*}
    p_i(x)=f_i+(x-x_i)m_i+(x-x_i)^2\frac{K_i-m_i}{x_{i+1}-x_i}
\end{equation*}
$K_i = f[x_i,x_{i+1}]=\frac{f_{i+1}-f_i}{x_{i+1}-x_i}$

$\bullet$Since s $\in C^1$, $p'_{i-1}(x_i)=p'_i(x_i)$. So
\begin{align*}
    m_{i-1} + 2(x_{i}-x_{i-1})&\frac{K_{i-1}-m_{i-1}}{x_{i}-x_{i-1}}=m_{i}\\
    m_i+m_{i-1}&=2K_{i-1}
\end{align*}
Because $m_1=f'(a)$, so
\begin{equation*}
    \left[\begin{array}{lllll}
        1 & & & & \\
        1 & 1 & & & \\
        & \ddots & \ddots & & \\
        & & 1 & 1 &  \\
        & & & 1 & 1
        \end{array}\right]\left[\begin{array}{l}
        m_1 \\
        m_2 \\
        \vdots  \\
        m_{n-2} \\
        m_{n-1}
        \end{array}\right] =\left[\begin{array}{l}
        f'(a) \\
        2K_1 \\
        \vdots \\
        2K_{n-3} \\
        2K_{n-2}
        \end{array}\right]
\end{equation*}
Solving the matrix equations can obtain $(m_1, m_2, \ldots, m_{n-1})$.

\section{}
Solution:\\
Let $s_2(x)=ax^3+bx^2+ex+d$. According to the interpolation condition and 
spline condition, we have 
\begin{equation*}
    \left\{\begin{aligned}
        &s_1(0)=s_2(0)\\
        &s'_1(0)=s'_2(0)\\
        &s''_1(0)=s''_2(0)\\
        &s''_2(1)=0\\
    \end{aligned}\right.
\end{equation*}
So
\begin{equation*}
    \left\{\begin{aligned}
        &1+c=d\\
        &3c=e\\
        &6c=2b\\
        &6a+2b=0\\
    \end{aligned}\right.
\end{equation*}
So $s_2(x)=-cx^3+3cx^2+3cx+c+1$. Let $s(1)=-1$. So $s_2(1)=-1, c=-\frac{1}{3}$.

\section{}
Solution:\\
$\bullet$Denote $m_i=s'(f;x_i)$ for s $\in \mathbb{S} _3^2$, for each i=2, 3. Then, we have
\begin{equation*}
    \begin{array}{c|cccc}
    -1 & 0 & & & \\
    -1 & 0 & m_1 & &  \\
    0  & 1 & 1   & 1-m_1 & \\
    0  & 1 & m_2 & m_2-1 & m_2+m_1-2\\  
    \end{array}
\end{equation*}
We have
\begin{align*}
    s_1(x) &= m_1(x+1)+(1-m_1)(x+1)^2+(m_2+m_1-2)(x+1)^2x\\
    s'_1(x)&= m_1+2(1-m_1)(x+1)+(m_2+m_1-2)(3x^2+4x+1)\\
    s''_1(x) &= 2(1-m_1)+(m_2+m_1-2)(6x+4)
\end{align*}
Similarly
\begin{equation*}
\begin{array}{c|cccc}
    0 & 1 & & & \\
    0 & 1 & m_2 & &  \\
    1 & 0 & -1   & -1-m_2 & \\
    1 & 0 & m_3 & m_3+1 & m_2+m_3+2\\  
    \end{array}
\end{equation*}
We have
\begin{align*}
    s_2(x) &= 1+m_2x+(-1-m_2)x^2+(m_3+m_2+2)x^2(x-1)\\
    s'_2(x) &= m_2+2(-1-m_2)x+(m_3+m_2+2)(3x^2-2x)\\
    s''_2(x) &= 2(-1-m_2)+(m_3+m_2+2)(6x-2)
\end{align*}
According to the interpolation condition and spline condition, we have
\begin{equation*}
    \left\{\begin{aligned}
        &s''_1(-1)=0\\
        &s''_2(1)=0\\
        &s_1(0)=s_2(0)\\
        &s'_1(0)=s'_2(0)\\
        &s''_1(0)=s''_2(0)\\
    \end{aligned}\right.
\end{equation*}
Then
\begin{equation*}
    \left\{\begin{aligned}
        &4m_1+2m_2=6\\
        &2m_2+4m_3=-6\\
        &2m_1+8m_2+2m_3=0\\
    \end{aligned}\right.
\end{equation*}
So $m_1=\frac{3}{2}, m_2=0, m_3=-\frac{3}{2}$. Then
\begin{equation*}
    s(x)=\left\{\begin{aligned}
        s_1(x)&=\frac{3}{2}(x+1)-\frac{1}{2}(x+1)^2-\frac{1}{2}(x+1)^2x &x\in[-1,0]\\
        &=-\frac{1}{2}x^3-\frac{3}{2}x^2+1\\
        s_2(x)&=1-x^2+\frac{1}{2}x^2(x-1) &x\in[0,1]\\
        &=\frac{1}{2}x^3-\frac{3}{2}x^2+1\\
    \end{aligned}\right.
\end{equation*}

$\bullet$Becouse $s''_1(x)=-3x-3, s''_2(x)=3x-3$, so
\begin{align*}
    \int_{-1}^{1} [s''(x)]^2 \,dx &= \int_{-1}^{0} [s''_1(x)]^2 \,dx +\int_{0}^{1} [s''_2(x)]^2 \,dx\\
    &=\int_{-1}^{0} (-3x-3)^2 \,dx +\int_{0}^{1} (3x-3)^2 \,dx\\
    &=6
\end{align*}
(i)We have
\begin{equation*}
    \begin{array}{c|ccc}
        -1 & 0 & &\\
        0 & 1 & 1 &\\
        1 & 0 & -1 & -1\\
    \end{array}
\end{equation*}
So $g(x)=x+1-(x+1)x=-x^2+1$. Then
\begin{align*}
    \int_{-1}^{1} [g''(x)]^2 \,dx &= \int_{-1}^{1} (-2)^2 \,dx\\
    &=8\\
    &>\int_{-1}^{1} [s''(x)]^2 \,dx
\end{align*}
(ii)Because $f(x)=\cos(\frac{\pi}{2}x)$, so $f''(x)=-\frac{\pi^2}{4}\cos(\frac{\pi}{2}x)$. Then
\begin{align*}
    \int_{-1}^{1} [f''(x)]^2 \,dx &= \int_{-1}^{1} [-\frac{\pi^2}{4}\cos(\frac{\pi}{2}x)]^2 \,dx\\
    &=\int_{-1}^{1} \frac{\pi^4}{16}\frac{1+\cos(\pi x)}{2} \,dx\\
    &=\frac{\pi^4}{16}\\
    &>6
\end{align*}
\end{document}